package com.leather.admin.feignclient;

import com.leather.admin.config.FeignConfig;
import com.leather.admin.feignclient.impl.JobClientHystrix;
import com.leather.common.entity.Job;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "campus-job", configuration = FeignConfig.class, fallback = JobClientHystrix.class)
public interface JobClient {

    @GetMapping("list")
    Object list(
            @RequestParam(value = "offset", required = false, defaultValue = "0") int offset,
            @RequestParam(value = "limit", required = false, defaultValue = "10") int limit,
            @RequestParam(value = "search", required = false, defaultValue = "") String search
    );

    @PostMapping(value = "addjob",consumes = "application/json")
    Object addJob(@RequestBody Job job);

    @PostMapping("deletejob")
    Object deleteJob(@RequestParam("jobId") int jobId);

}
